package org.zw.android.framework.app;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;

public class AppResourceUtil {
	
	private static Resources mRes ;

	private AppResourceUtil(){
		
	}
	
	public static void initResource(Context context){
		
		if(context != null){
			mRes	= context.getResources();
		}
	}
	
	public static int getDimensionPixelSize(int rid){
		
		if(mRes != null){
			return mRes.getDimensionPixelSize(rid);
		}
		
		return 0 ;
	}
	
	public static int getDimensionPixelOffset(int rid){
		
		if(mRes != null){
			return mRes.getDimensionPixelOffset(rid);
		}
		
		return 0 ;
	}
	
	public static Drawable getDrawable(int rid){
		
		if(mRes != null){
			return mRes.getDrawable(rid);
		}
		
		return null ;
	}
	
	public static int getColor(int rid){
		
		if(mRes != null){
			return mRes.getColor(rid);
		}
		
		return 0 ;
	}
	
	public static ColorStateList getColorStateList(int rid){
		
		if(mRes != null){
			return mRes.getColorStateList(rid);
		}
		
		return null ;
	}
	
	public static String getString(int rid){
		
		if(mRes != null){
			return mRes.getString(rid);
		}
		
		return null ;
	}
	
	public static String[] getStringArray(int rid){
		
		if(mRes != null){
			return mRes.getStringArray(rid);
		}
		
		return null ;
	}
}
